package unpackaged;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import tt.dz.entity.exception.BizException;
import tt.dz.tcp.rpc.ms.SystemMasterServerRpcClient;
import tt.dz.tcp.rpc.ms.client.entity.*;

import java.io.IOException;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-task.xml")
//@TransactionConfiguration(defaultRollback=false,transactionManager="transactionManager")
//@Transactional 
//@FixMethodOrder(MethodSorters.DEFAULT)
public class OmsRequestMasterServer
{
	@Autowired
	private SystemMasterServerRpcClient omsFactoryListDaoImpl;
	@Test
	public void testMasterLogin()
	{
		MasterLoginParam obj = new MasterLoginParam();
		obj.setMobileNo("18615710512");
		obj.setPassword("123456");
		obj.setSysCode("103");
		omsFactoryListDaoImpl.systemLoginInteface(obj );
	}
	
	@Test
	public void testQueryUser()
	{
		MasterQueryUserByDateParam obj = new MasterQueryUserByDateParam();
		obj.setStartDate("2015-12-10");
		obj.setEndDate("2016-01-20");
		obj.setSysCode("103");
		omsFactoryListDaoImpl.systemUserQueryInteface(obj);
	}
	
	@Test
	public void testQueryMerchant() throws BizException
	{
		MasterMerchantParam obj = new MasterMerchantParam();
//		obj.setStartTime("2015-12-10");
//		obj.setEndTime("2016-02-20");
//		obj.setProviderType(1);
//		obj.setSysCode("103");
		MasterMerchantResult r = omsFactoryListDaoImpl.systemQueryMerchantInteface(obj);
		System.out.println(r);
	}
	
	@Test
	public void testLogin()
	{
		MasterOtherLoginParam obj = new MasterOtherLoginParam();
		obj.setMobileNo("18615710512");
//		obj.setUserId("11012016012700000140");
		obj.setPassword("123456");
		obj.setSysCode("103");
		omsFactoryListDaoImpl.systemOtherLoginInteface(obj);
	}
	
	@Test
	public void testAddRole()
	{
		MasterAddRoleParam obj = new MasterAddRoleParam();
		obj.setRoleId("11012016012700000140");
		obj.setRoleName("运营系统同步添加");
		obj.setSysCode("00002");
		obj.setCreatedBy("201610001");

		try
		{
			omsFactoryListDaoImpl.addSysRole(obj);
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
	
	@Test
	public void testAddUser()
	{
		MasterAddUserParam obj = new MasterAddUserParam();
		obj.setRoleList(new String[]{"11012016012700000140"});
		obj.setEmail("1234@dz.tt");
		obj.setMobileNo("18902880415");
		obj.setName("王老板12344");
		obj.setPassword("123456");
		obj.setSysCode("00002");
		obj.setCreatedBy("201610001");

		omsFactoryListDaoImpl.addSysUser(obj);
	}
	
	@Test
	public void testModifyPwd()
	{
		MasterModifyPwdParam obj = new MasterModifyPwdParam();
		obj.setManagerId("18615710512");
		obj.setPassword("123456");
		obj.setNewPassword("123qwe");
		obj.setRepeatPassword("123qwe");
//		omsFactoryListDaoImpl.systemUserModifyPwdInteface(obj);
	}
	
	

}
